package com.foreknow.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ManageServlet extends HttpServlet {

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //我们只需 要在doGet中获取到请求的参数q=list，然后根据获取到的参数来决定调用哪一个方法
    String method = req.getParameter("q");
    if("delete".equals(method)) {
      delete(req,resp);
    }else if("update".equals(method)){
      update(req,resp);
    }else {
      list(req,resp);
    }
  }

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

  }

  //查询所有信息的方法
  protected void list(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  }

  //删除
  protected void delete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  }

  //修改
  protected void update(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

  }

}
